<?php

/**
 * Input7dAgromet filter form base class.
 *
 * @package    TMD
 * @subpackage filter
 * @author     Thaihosting
 */
abstract class BaseInput7dAgrometFormFilter extends BaseFormFilterPropel
{
  public function setup()
  {
    $this->setWidgets(array(
      'DTSAVE_TIME'        => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'IUSER_ID'           => new sfWidgetFormFilterInput(),
      'SEFFECT_TH'         => new sfWidgetFormFilterInput(),
      'SEFFECT_ENG'        => new sfWidgetFormFilterInput(),
      'SWEATHER_TH'        => new sfWidgetFormFilterInput(),
      'SWEATHER_ENG'       => new sfWidgetFormFilterInput(),
    ));

    $this->setValidators(array(
      'DTSAVE_TIME'        => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
      'IUSER_ID'           => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'SEFFECT_TH'         => new sfValidatorPass(array('required' => false)),
      'SEFFECT_ENG'        => new sfValidatorPass(array('required' => false)),
      'SWEATHER_TH'        => new sfValidatorPass(array('required' => false)),
      'SWEATHER_ENG'       => new sfValidatorPass(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('input7d_agromet_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'Input7dAgromet';
  }

  public function getFields()
  {
    return array(
      'DTTIME_FORECAST'    => 'Date',
      'IGEOGRAPHIC_REGION' => 'Number',
      'DTSAVE_TIME'        => 'Date',
      'IUSER_ID'           => 'Number',
      'SEFFECT_TH'         => 'Text',
      'SEFFECT_ENG'        => 'Text',
      'SWEATHER_TH'        => 'Text',
      'SWEATHER_ENG'       => 'Text',
    );
  }
}
